//二级菜单导航栏
function select(i) {
	$('.hangder ul li').eq(i).addClass('active').siblings().removeClass('active');
	$('.hangder .content >div').eq(i).show().siblings().hide();
}
$('.lit').click(function() {
	$(".content").removeClass('height')
})

//养生心知   音频  视频   图文
//var Id = 1627;
$.ajax({
	type: "post",
	url: Urls + "/api/Cms/GetCmsDetailV1",
	data: JSON.stringify({
		"Id": Id,
		"MemberToken": ""
	}),
	success: function(res) {
		var data = res.Data;
//		$('.content .audio').find('audio').attr('src', data.AudioUrl[0]);
//		$('.content .video').find('video').attr('src', data.AttachmentUrl[0])
		$('.content .text .text_title h4').text(data.Title)
		document.querySelector('.text_content').innerHTML = data.Content;
		$('.hangder h4').text(data.Title);
		$('.audio_img').find('img').attr('src', data.ThumbnailUrl[0]);
		$('.video').find('video').attr('poster', data.ThumbnailUrl[0]);

	}
});

//轮播图
$.ajax({
	type: "post",
	url: Urls + "/api/Special/GetClassList",
	data: JSON.stringify({
		"PageIndex": 1,
		"PageSize": 5,
		"MemberAccount": "",
		"SpecialId": 0,
		"ClassId": Id
	}),
	success: function(res) {
		var ClassList = res.Data.ClassList;
		for(var i = 0; i < ClassList.length; i++) {
			var sweime = '<div class="swiper-slide sweione">' +
				'<img src="' + ClassList[i].PhotoUrl + '" />' +
				'<p>' + ClassList[i].Title + '</p>' +
				'</div>';
			$('.swiper-wrapper').append(sweime);
		}
		//轮播图
		var mySwiper = new Swiper('.swiper-container', {
			slidesPerView: 2, //'auto'
			observer: true, //修改swiper自己或子元素时，自动初始化swiper
			observeParents: false, //修改swiper的父元素时，自动初始化swiper
			onTransitionEnd: function(swiper) {
				if(swiper.progress == 1) {
					swiper.activeIndex = swiper.slides.length - 1
				}
			}
		})
	}
});

//评论接口
$.ajax({
	type: "post",
	url: Urls + "/api/Cms/GetComment",
	data: JSON.stringify({
		"ObjectId": Id,
		"ParentId": "0",
		"Type": "OBJECT",
		"PageIndex": 1,
		"PageSize": 5,
		"MemberAccount": "",
		"CommentType": "REGIMEN"
	}),
	success: function(res) {
		console.log(res)
		var Data = res.Data;
		$('.comment_p span').text(res.TotalCount);
		for(var i = 0; i < Data.length; i++) {
			var Class_comment = '<li>' +
				'<div>' +
				'<div><img src="' + Data[i].Icon + '" /></div>' +
				'<div>' +
				'<p>' + Data[i].Name + '</p>' +
				'<p>' + Data[i].CommentDate + '</p>' +
				'</div>' +
				'<div>' +
				'<img src="img/2.png" />' +
				'<p>' + Data[i].PraiseTime + '</p>' +
				'</div>' +
				'</div>' +
				'<div>' +
				'<p>' + Data[i].Content + '</p>' +
				'</div>' +
				'</li>';
			$('.comments ul').append(Class_comment)
		}

	}
})